package com.test.application.practice.string;

/**
 * 描述: TODO
 * 作者: yanruizhi
 * 时间: 2024/8/5 19:59
 */
public class Practice01 {
    public static void main(String[] args) {
//        输入一个字符串，其中包含空格隔开的多个单词，要求将字符串进行反转，但是单词不反转。
//        "hello world"->"world hello","my name is xiaoming"-"xiaoming is name my"
        String str = "my name is xiaoming";
        String[] arr = str.split(" ");
        int len = arr.length;
        int temp = len - 1;
        String resultStr = "";
        while (temp >= 0){
            resultStr += arr[temp] + " ";
            temp--;
        }

        System.out.println(resultStr);
    }

}
